﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("-------------欢迎进入游戏世界-------------");
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("-------------欢迎进入游戏世界-------------");
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("出拳规则：1.剪刀，2.石头，3.布");
            Console.WriteLine("请选择敌方角色：1.刘备，2.孙权，3.曹操");
            int num = int.Parse(Console.ReadLine());
            string str = Convert.ToString(num);
            switch (num)
            {
                case 1:
                    str = "刘备";
                    break;
                case 2:
                    str = "孙权";
                    break;
                case 3:
                    str = "曹操";
                    break;
            }
            Computer computer = new Computer(str);
            Console.WriteLine("请输入您的名字");
            string name = Console.ReadLine();
            Player player = new Player(name);
            Referee referee = new Referee(name,str);

            switch (num)
            {
                case 1:
                    Console.WriteLine(name + " " + "VS" + " " + "刘备" + " " + "对战");
                    Test(referee, computer, player);
                    break;
                case 2:
                    Console.WriteLine(name + " " + "VS" + " " + "孙权" + " " + "对战");
                    Test(referee, computer, player);
                    break;
                case 3:
                    Console.WriteLine(name + " " + "VS" + " " + "曹操" + " " + "对战");
                    Test(referee, computer, player);
                    break;
            }
            Player player1 = new Player(name);
            player1.Really();
            Computer computer1 = new Computer(str);
            computer1.Check();
        }
        public static void Test(Referee referee, Computer computer, Player player)
        {
            Console.WriteLine("游戏开始吗？<y/n>");
            string str = Console.ReadLine();
            switch (str)
            {
                case "y":
                    Test1(referee, computer, player);
                    break;
                case "n":
                    Console.WriteLine("欢迎下次光临");
                    break;
            }
        }
        public static void Test1(Referee referee, Computer computer, Player player)
        {
            while (true)
            {
                int n1 = player.Really();
                int n2 = computer.Check();
                referee.Result(n1, n2);
                Console.WriteLine("是否进入下一轮(y/n)");
                string str = Console.ReadLine();
                switch (str)
                {
                    case "y":
                        Test1(referee, computer, player);
                        break;
                    case "n":
                        referee.Finally();
                        break;
                }
            }
        }
    }

}
